package com.example.shixun.service.impl;

import com.example.shixun.dao.CourseStudentDao;
import com.example.shixun.pojo.CourseStudent;
import com.example.shixun.service.CourseStudentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CourseStudentServiceImpl implements CourseStudentService {
    @Resource
    CourseStudentDao courseStudentDao;

    @Override
    public Integer saveCourseStudent(CourseStudent courseStudent) {
        return courseStudentDao.saveCourseStudent(courseStudent);
    }

    @Override
    public Integer deletsCourseStudent(Integer courseId, Integer studentId) {
        return courseStudentDao.deletsCourseStudentById(courseId,studentId);
    }

    @Override
    public List<CourseStudent> selectCourseStudentByCourseId(Integer courseId) {
        return courseStudentDao.selectCourseStudentByCourseId(courseId);
    }

    @Override
    public List<CourseStudent> selectCourseStudentByStudentId(Integer studentId) {
        return courseStudentDao.selectCourseStudentByStudentId(studentId);
    }

    @Override
    public Boolean studiedFlag(CourseStudent courseStudent) {
        Integer n = courseStudentDao.studiedFlag(courseStudent);
        if(n>0) return true;
        return false;
    }
}
